#绝对布局  窗口指定每一个控件显示的坐标和大小来布局的
import sys
from  PyQt5.QtWidgets import *
class Example(QWidget):
    def __init__(self,parent=None):
        super(Example,self).__init__(parent)
        self.setWindowTitle("在控件中布局")
        self.resize(700,800)
        wwg=QWidget(self)
        wlayout=QHBoxLayout(wwg)
        #局部布局
        hlayout=QHBoxLayout()
        vlayout=QVBoxLayout()
        gridlayout=QGridLayout()
        formlayout=QFormLayout()

        hlayout.addWidget(QPushButton("1"))
        hlayout.addWidget(QPushButton("2"))

        vlayout.addWidget(QPushButton("3"))
        vlayout.addWidget(QPushButton("4"))

        gridlayout.addWidget(QPushButton("5"),0,0)
        gridlayout.addWidget(QPushButton("6"),0,1)
        gridlayout.addWidget(QPushButton("7"),1,0)
        gridlayout.addWidget(QPushButton("8"),1,1)

        formlayout.addWidget(QPushButton("9"))
        formlayout.addWidget(QPushButton("10"))
        formlayout.addWidget(QPushButton("11"))
        formlayout.addWidget(QPushButton("12"))
        #准备四个部件
        wlayout.addLayout(hlayout)
        wlayout.addLayout(vlayout)
        wlayout.addLayout(gridlayout)
        wlayout.addLayout(formlayout)

if __name__ == '__main__':
    app=QApplication(sys.argv)
    demo=Example()
    demo.show()
    sys.exit(app.exec_())
